package com.whw.fy.controller;

import com.whw.fy.entity.Message;
import com.whw.fy.entity.Plans;
import com.whw.fy.entity.Plansclazz;
import com.whw.fy.service.PlansService;
import com.whw.fy.service.PlansclazzService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;

@Api(tags = "班级教学计划模块")
@RestController
@RequestMapping("/api/plansClazz")
public class PlansclazzController {

    @Resource
    private PlansclazzService plansclazzService;

    @ApiOperation(value = "添加计划信息")
    @PostMapping("/one")
    public Message insert(Plansclazz plansclazz) {
        plansclazz.setPlansclazzPostTime(new Date());
        return plansclazzService.insertSelective(plansclazz);
    }

    @ApiOperation(value = "删除计划")
    @DeleteMapping("/")
    public Message delete(Integer Id) {
        return plansclazzService.deleteByPrimaryKey(Id);
    }

    @ApiOperation(value = "修改计划")
    @PutMapping("/")
    public Message update(Plansclazz plansclazz) {
        return plansclazzService.updateByPrimaryKeySelective(plansclazz);
    }

    @ApiOperation(value = "获取所有计划")
    @GetMapping("/all")
    public Message selectAll(){
        return plansclazzService.selectALL();
    }

    @ApiOperation(value = "根据计划id获取计划")
    @GetMapping("/one")
    public Message selectByPrimaryKey(Integer Id){
        return plansclazzService.selectByPrimaryKey(Id);
    }

    @ApiOperation(value = "根据班级Id获取计划")
    @GetMapping("/classId")
    public Message selectByClassId(Integer classId){
        return plansclazzService.selectAllByPlansclazzClazzId(classId);
    }

    @ApiOperation(value = "根据授课老师id查询旗下获取所有班级计划")
    @GetMapping("/all/TeacherIdJurisdictionEight")
    public Message selectallByTeacherIdJurisdictionEight(int staffId){
        return plansclazzService.selectallByTeacherIdJurisdictionEight(staffId);
    }

    @ApiOperation(value = "根据医疗主管id查询旗下所有班级计划")
    @GetMapping("/all/MedicalDirectorIdJurisdictionZero")
    public Message selectallByMedicalDirectorIdJurisdictionZero(int staffId){
        return plansclazzService.selectallByMedicalDirectorIdJurisdictionZero(staffId);
    }

    @ApiOperation(value = "根据教学主管id查询旗下所有班级计划")
    @GetMapping("/all/TeachingDirectorJurisdictionSix")
    public Message selectallByTeachingDirectorJurisdictionSix(int staffId){
        return plansclazzService.selectallByTeachingDirectorJurisdictionSix(staffId);
    }

    @ApiOperation(value = "根据主责老师id查询旗下所有班级计划")
    @GetMapping("/all/principalTeacherJurisdictionSeven")
    public Message selectallByprincipalTeacherJurisdictionSeven(int staffId){
        return plansclazzService.selectallByprincipalTeacherJurisdictionSeven(staffId);
    }
}
